package com.littleII.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.littleII.enumber.Language;
import com.littleII.enumber.SoftType;
import com.littleII.enumber.Type;

@Entity
@Table(name="soft")
public class SimpleSoft implements Serializable{
	private static final long serialVersionUID = 2973017815056555168L;

	private Integer id;
	private String name; // 软件名
	private String size; // 软件大小
	private String unit;// 软件大小的单位 如：K|M|G
	private Date lastModifyTime; // 最后更新时间
	@Enumerated(EnumType.ORDINAL)
	private SoftType type; // 软件类型 如:免费软件|共享软件
	private String downloadURL; // 默认的下载地址
	private List<DownloadURL> downloadURLs; // 多种下载地址,分电信,网通等
	private String pngURL; // 图标地址
	private String detailURL; // 详情地址
	private String oe; // 运行环境
	private String simpleDesc; // 软件的简要说明
	private String sDesc; // 软件的详细说明
	private String officialWebsiteURL;// 开发商URL
	private String downloadCount;	//下载次数
	@Enumerated(EnumType.ORDINAL)
	private Language language;	//软件语言
	@Enumerated(EnumType.ORDINAL)
	private Type sType;	//软件类别

	/**
	 * @return the sDesc
	 */
	public String getsDesc() {
		return sDesc;
	}

	/**
	 * @return the detailURL
	 */
	public String getDetailURL() {
		return detailURL;
	}

	/**
	 * @return the downloadCount
	 */
	public String getDownloadCount() {
		return downloadCount;
	}

	/**
	 * @return the downloadURL
	 */
	public String getDownloadURL() {
		return downloadURL;
	}

	/**
	 * @return the downloadURLs
	 */
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn (name = "softId",nullable = false)
	public List<DownloadURL> getDownloadURLs() {
		return downloadURLs;
	}

	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	/**
	 * @return the language
	 */
	public Language getLanguage() {
		return language;
	}

	/**
	 * @return the lastModifyTime
	 */
	public Date getLastModifyTime() {
		return lastModifyTime;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the oe
	 */
	public String getOe() {
		return oe;
	}

	/**
	 * @return the officialWebsiteURL
	 */
	public String getOfficialWebsiteURL() {
		return officialWebsiteURL;
	}

	/**
	 * @return the pngURL
	 */
	public String getPngURL() {
		return pngURL;
	}

	/**
	 * @return the simpleDesc
	 */
	@Lob
	@org.hibernate.annotations.Type(type="text")
	@Column(name="simpleDesc",nullable=true)
	public String getSimpleDesc() {
		return simpleDesc;
	}

	/**
	 * @return the size
	 */
	public String getSize() {
		return size;
	}

	/**
	 * @return the sType
	 */
	public Type getsType() {
		return sType;
	}

	/**
	 * @return the type
	 */
	public SoftType getType() {
		return type;
	}

	/**
	 * @return the unit
	 */
	public String getUnit() {
		return unit;
	}

	/**
	 * @param desc the desc to set
	 */
	public void setsDesc(String sDesc) {
		this.sDesc = sDesc;
	}

	/**
	 * @param detailsURL
	 *            the detailURL to set
	 */
	public void setDetailURL(String detailURL) {
		this.detailURL = detailURL;
	}

	/**
	 * @param downloadCount the downloadCount to set
	 */
	public void setDownloadCount(String downloadCount) {
		this.downloadCount = downloadCount;
	}

	/**
	 * @param downloadURL
	 *            the downloadURL to set
	 */
	public void setDownloadURL(String downloadURL) {
		this.downloadURL = downloadURL;
	}

	/**
	 * @param downloadURLs
	 *            the downloadURLs to set
	 */
	public void setDownloadURLs(List<DownloadURL> downloadURLs) {
		this.downloadURLs = downloadURLs;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @param language the language to set
	 */
	public void setLanguage(Language language) {
		this.language = language;
	}

	/**
	 * @param lastModifyTime
	 *            the lastModifyTime to set
	 */
	public void setLastModifyTime(Date lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param oe
	 *            the oe to set
	 */
	public void setOe(String oe) {
		this.oe = oe;
	}

	/**
	 * @param officialWebsiteURL
	 *            the officialWebsiteURL to set
	 */
	public void setOfficialWebsiteURL(String officialWebsiteURL) {
		this.officialWebsiteURL = officialWebsiteURL;
	}

	/**
	 * @param pngURL
	 *            the pngURL to set
	 */
	public void setPngURL(String pngURL) {
		this.pngURL = pngURL;
	}

	/**
	 * @param simpleDesc
	 *            the simpleDesc to set
	 */
	public void setSimpleDesc(String simpleDesc) {
		this.simpleDesc = simpleDesc;
	}

	/**
	 * @param size
	 *            the size to set
	 */
	public void setSize(String size) {
		this.size = size;
	}

	/**
	 * @param sType the sType to set
	 */
	public void setsType(Type sType) {
		this.sType = sType;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(SoftType type) {
		this.type = type;
	}

	/**
	 * @param unit
	 *            the unit to set
	 */
	public void setUnit(String unit) {
		this.unit = unit;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "SimpleSoft [名称=" + name + ", 类型=" + type + ", 软件大小=" + size
				+ " " + unit + ", 详情地址=" + detailURL + ", 下载地址="
				+ downloadURL + ", 最后修改时间=" + lastModifyTime + ", 运行环境=" + oe
				+ ", 图片地址=" + pngURL + ", 开发商=" + officialWebsiteURL + ", 简要说明=" + simpleDesc + "]";
	}

}
